package Entity;

import java.text.SimpleDateFormat;
import java.util.Date;

import Control.MySQLController;

public class Customer_CustomerMembership extends User{
	
	//****************Additional Attributes for Customer****************//
	//
	//
	private String custSignUpDate; 
	private String custLogInTime;
	private String custLogInDate;
	private String custPassword; 
	private String custCfmPassword;		
	private String custSecurityQn;
	private String custSecurityAns;

	
	//****************Attributes FROM USER ****************//
	/*String nric, String name, String username, String email,
	int contact_no, Date dob, String address, char gender,
	String security_qn, String security_ans, String race_status_code,
	String user_status_code
	//*****************************************************/
	
	public Customer_CustomerMembership(){}

	//Constructor
	public Customer_CustomerMembership(String nric, String name,
			String username, String email, int contact_no, Date dob,
			String address, char gender, String security_qn,
			String security_ans, String race_status_code,
			String user_status_code,String custPassword,  String custSignUpDate,String custLogInTime,
			String custLogInDate,String userType) {
		super(nric, name, username, email, contact_no, dob, address, gender, security_qn,security_ans,race_status_code,
				 user_status_code, custPassword);
		
		//Separate userType for customer
		super.setCustomerUserType(userType);
		this.custSignUpDate = custSignUpDate;
		this.custLogInTime = custLogInTime;
		this.custLogInDate = custLogInDate;

	}
	

		
	
		
		// Create membership 
		public boolean createMembership() {
			boolean success = false; 
			createUserRecord();
			MySQLController db = new MySQLController();
			db.getConnection();
			String sql = "INSERT INTO ooadpj.customer (nric,type, signUpDate, LastLogInTime, lastLogInDate)";
			sql+="VALUES ('"+this.getNric()+"','"+ getCustomerUserType()+"','"+this.custSignUpDate+"', null,null)";  
			
			
			System.out.print("first : "+sql);
			if(db.updateRequest(sql)==1)
				success = true;
			db.terminate();
			return success;
		}

		

}
